package dao;


import org.apache.ibatis.annotations.*;
import pojo.User;

import java.util.List;

public interface UserMapper {

    @Select("select * from user")
    List<User> getUsers();

    //方法存在多个参数，所有的参数前面必须加上@Param
    //@Param("id")要对应SQL里的参数#{id}
    @Select("select * from user where id=#{id}")
    User getUserById(@Param("id") int idddd);

    @Insert("insert into user (id,name,pwd) values(#{id},#{name},#{password})")
    int addUser(User user);

    @Update("update user set name=#{name},pwd=#{password} where id=#{id}")
    int updateUser(User user);

    @Delete("delete from user where id=#{uid}")
    int deleteUser(@Param("uid") int id);

    @Insert("insert into user (id,pwd) values(#{uid},#{password})")
    int addUserStr(@Param("uid") int id,@Param("password") String pwd);
}
